<template>
  <el-row>
    <el-button round @click="push">push</el-button>
    <el-button type="danger" @click="getUserById">getUserById</el-button>
    <el-button type="danger" @click="findAll">findAll</el-button>
    <el-button type="danger" @click="createUser">createUser</el-button>
    <el-button type="danger" @click="findPage">findPage</el-button>
  </el-row>
</template>

<script lang="ts">
import router from "/@/router";
import $api from '/@/apis/api'

export default {
  setup(props, context): any {
    let push = () => {
      console.info(props)
      console.info(context)
      router.push({path: '/other'})
    }

    let getUserById = () => {
      $api.user.getUserById1(13).then(res => {
        console.info(res)
      })

      $api.user.getUserById2(3).then(res => {
        console.info(res)
      })
    }

    let findAll = () => {
      $api.user.findAll().then(res => {
        console.info(res)
      })
    }
    let createUser = () => {
      $api.user.createUser({name: 'zhangsan', gender: 1, age: 18}).then(res => {
        console.info(res)
      })
    }
    let findPage = () => {
      $api.user.findPage("{name:\"zhangsan\",gender:1,pageNum:12}").then(res => {
        console.info(res)
      })
    }

    return {
      push, getUserById, findAll, createUser, findPage
    }
  }
}
</script>

<style scoped lang="scss">

</style>
